package cc.liyinghao.service.impl;

import cc.liyinghao.common.pojo.ChatList;
import cc.liyinghao.config.DefaultIpPrefixConfig;
import cc.liyinghao.mapper.ChatListMapper;
import cc.liyinghao.response.MessageUserListVo;
import cc.liyinghao.service.ChatListService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@RequiredArgsConstructor
public class ChatListServiceImpl implements ChatListService {

    private final ChatListMapper chatListMapper;
    private final DefaultIpPrefixConfig defaultIpPrefixConfig;

    @Override
    public List<MessageUserListVo> getChatList(int userId) {
        List<MessageUserListVo> messageUserListVoList =  chatListMapper.getChatList(userId);
        messageUserListVoList.forEach(messageUserListVo -> {
            messageUserListVo.setHeadImgUrl(defaultIpPrefixConfig.getDefaultStaticIp() + messageUserListVo.getHeadImgUrl());
        });
        return messageUserListVoList;
    }

    @Override
    public void deleteChatList(int userId, int chatId) {

    }

    @Override
    public void clearChatList(int userId, int chatId) {

    }
}
